package org.xx.armory.swing.builders;

import org.xx.armory.objectparser.ParsedObjectBuilder;

import java.util.ArrayList;
import java.util.List;

public class OptionsModelBuilder
        extends ParsedObjectBuilder<OptionsModel>
        implements OptionsContainerBuilder {
    private String name;
    private List<OptionModel> options;

    public OptionsModelBuilder() {
        this.options = new ArrayList<>();
    }

    public OptionsModelBuilder setName(
            String name
    ) {
        this.name = name;
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public void addOption(
            OptionModel option
    ) {
        this.options.add(option);
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public OptionsModel build() {
        return new OptionsModel(getLineInfo(), this.name, this.options);
    }
}
